/**
 * 
 */
package com.hoopchina.util.json;

import java.io.IOException;
import java.util.List;

import org.apache.http.client.ClientProtocolException;


/**
 * @author Guo Baiyu
 *
 */
public abstract class JsonInfo {

    protected String mUrl;

    /**
     * 
     */
    public JsonInfo() {
        this.mUrl = null;
    }

    /**
     * 
     */
    public JsonInfo(String url) {
        this.mUrl = url;
    }

    public void setUrl(String url){
        this.mUrl = url;
    }
  
    public String getUrl() {
        return this.mUrl;
    }


    /**
     * 
     * @param url
     * @return List<String> 
     */
    public List<?> getInfoFromJson() {
        List<?> list = null;
        try {
            //
            String jsonString = JsonEngine.getJson( mUrl );
            list = parseJson( jsonString );
//            FlowRateManagement.addFlowRate( MainView.getActivity(),
//                    FlowRateManagement.FLOW_RATE_AUTO, json.length() );
        }
        catch ( ClientProtocolException e ) {
            e.printStackTrace();
        }
        catch ( IOException e ) {
            e.printStackTrace();
        }
        return list;
    }
    
    /**
     * 解析json成为可用的信息
     * @param jsonString
     * @return
     */
    abstract List<?> parseJson(String jsonString);
}

    